<?php

/*
 * This page is displayed when a registration is cancelled
 * there are two states that we need to deal with here
 * 1. cancellation requires confirmation
 * 2. confirm to the user that the cancellation has taken place
 * User needs to confirm on this page
 * Called fron users.php
 * function cancelreg($key)
 * Written By Anton Foster 
 * March 2013
 * 
 * cforum.kelsamfos.com/index.php/auth/cancelreg/51363ad289bee13a4d000000
 */

echo '<div id="contentfull">';
echo '<div id="forms">';
echo '<a href="'.$baseurl.'"><img src="'.$baseurl.'public/images/close.png" align="right" alt="close" title="Close" border="0" /></a>';
switch ($type) {
    case 'cancel':
        // Email is not yet verified
        confirmcancel($baseurl, $rid, $Name);
        
        break;
    case 'conf':
        // This shows a page that confirms to the user that the registration has been cancelled and data deleted
        cancelled();
        break;
    
    default:
        cancelled();
        break;
}

echo '</div> <!-- contentfull -->';
echo '</div> <!-- forms -->';



function confirmcancel($baseurl, $rid, $Name) {
    echo '<h2> Sorry that you are cancelling your registration </h2><br /> 
        '.$Name.' Please could you help us to improve our process and provide us feedback as to why you wish to cancel your registration';
    $hidden = array('id' => $rid);
    // echo '<a href="'.$baseurl.'index.php/users"><img src="'.$baseurl.'public/images/close.png" align="right" alt="close" border="0" /></a>';
    echo form_open($baseurl.'index.php/auth/cancelreg/'.$rid, '',$hidden);
    echo form_fieldset('<h2>   Cancel Registration   </h2>');     
    echo 'Reason for cancelling : <br />'; 
    $reason = array('name' => 'reason', 
       'id' => 'reason',  
       'maxlength'   => '200',
       'style'       => 'width: 400px; height: 100px' ); ?> 
    <?php echo form_textarea($reason);
    echo '<p>When you confirm the cancellation your information will be deleted and if you want to register you will have to start the process again </p>';
    echo form_submit('confirm', 'Confirm'); 
    echo form_reset('reset', 'Reset');  
    form_fieldset_close();
    form_close();
    
    echo '<br />
    <br />
    Thank you <br />
    <br />
    The Forum Team
    ';
}

function cancelled() {
    echo '<h2> Registration to this site has been cancelled and removed </h2><br /> 
          
    <br />
    <br />
    Goodbye <br />
    <br />
    The Forum Team
    ';
}



    ?>